﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Ghasam.Business" namespace="Ghasam.Business.Domain.Entity">
	<class name="Payment" table="Payment" lazy="true">
		<id name="Id" type="Int32" unsaved-value="0">
			<column name="ID" sql-type="int" not-null="true" unique="true" index="ID" />
			<generator class="native" />
		</id>

		<many-to-one class="Customer" name="Customer" not-null="false" column="CustomerId" />
		<many-to-one class="PaymentType" name="PaymentType" column="PaymentType" />
		
		<property name="Amount" column="Amount" type="Single" />
		<property name="PaymentDate" column="PaymentDate" type="DateTime" />
		<property name="LastUpdate" column="LastUpdate" type="DateTime" />

		<joined-subclass name="PaymentCheque" table="PaymentCheque" extends="Payment">
			<key column="PaymentId" />
			<property name="ChequeNumber" column="ChequeNumber" type="String" length="50" />
			<property name="BankName" column="BankName" type="String" length="50" />
			<property name="BankBranch" column="BankBranch" type="String" length="50" />
			<property name="ChequeDate" column="ChequeDate" type="DateTime" />
			<property name="Comment" column="Comment" type="String" length="300" />
			<property name="Cashed" column="Cashed" type="Boolean" />
			<property name="PaidTo" column="PaidTo" type="String" length="50" />
			<property name="PaidDate" column="PaidDate" type="DateTime" />
		</joined-subclass>

    <joined-subclass name="PaymentCash" table="PaymentCash" extends="Payment">
      <key column="PaymentId" />
      <property name="OneTimeCustomer" column="OneTimeCustomer" type="String" length="100" />
      <many-to-one class="Invoice" name="Invoice" column="InvoiceId" />
    </joined-subclass>
		
	</class>
</hibernate-mapping>